﻿{extend name="layout/layout" /}
<!--请在下方写此页面body相关内容-->
{block name="container"}
<div class="page-container">
    <form action="<?php echo url('category/categoryList')?>" method="get">
        <div class="text-c">
            <input type="text" class="input-text" style="width:250px" placeholder="输入分类名称" name="search_name" value="<?php echo isset($params['search_name']) ? $params['search_name'] : ''?>">
            <button type="submit" class="btn btn-success radius"><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
        </div>
    </form>
	<div class="cl pd-5 bg-1 bk-gray mt-20">
		<span class="l"><a href="javascript:;" onclick="show('添加分类','<?php echo url('category/categorySave')?>','','300')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加分类</a></span>
        <span class="r mt-5">共有记录：<strong><?php echo $count;?></strong> 条</span>
	</div>
	<table class="table table-border table-bordered table-hover table-bg table-sort mt-10">
		<thead>
			<tr class="text-c">
				<th width="40">ID</th>
				<th>分类名称</th>
				<th width="70">状态</th>
				<th width="70">操作</th>
			</tr>
		</thead>
		<tbody>
		<?php foreach($list as $v){?>
		<tr class="text-c pid_<?php echo $v['pid']?> topid_<?php echo $v['topid']?>" <?php if(!isset($params['search_name']) && $v['deep'] == 2) echo 'hidden';?>>
		<td><?php echo $v['id']?></td>
        <?php if(!isset($params['search_name'])){?>
		<td class="operate" style="text-align: left; padding-left: 10px">
            <?php if(empty($v['deep'])){
            	echo '<span></span><a onClick="onHide(this,'.$v['id'].','.$v['deep'].')" data="1"><span><i class="Hui-iconfont">&#xe6a1; </i></span></a>';
            } else if ($v['deep'] == 1) {
                echo '<span>'.str_repeat('&nbsp',$v['deep']*4).'</span><a onClick="onShow(this,'.$v['id'].','.$v['deep'].')" data="0"><span><i class="Hui-iconfont">&#xe600; </i></span></a>';
            } else {
                echo str_repeat('&nbsp',$v['deep']*4);
            }
            echo $v['category_name'];
            ?>
		</td>
        <?php } else echo '<td>'.$v['category_name'].'</td>'?>
		<td class="td-status"><span class="label <?php echo $v['status'] == 1 ? 'label-success' : 'label-defaunt';?> radius">
            <?php echo $v['status'] == 1 ? '已启用' : '已禁用';?></span></td>
		<td class="td-manage">
            <?php if($v['status'] == 1){?>
            <a href="javascript:;" title="禁用" onclick="status(this,'<?php echo url('category/status')?>','<?php echo $v['id']?>', 2, '禁用')"><i class="Hui-iconfont">&#xe60e;</i></a>
            <?php } if($v['status'] == 2) {?>
            <a href="javascript:;" title="启用" onclick="status(this,'<?php echo url('category/status')?>','<?php echo $v['id']?>', 1, '启用')"><i class="Hui-iconfont">&#xe605;</i></a>
            <?php }?>
            <a class="ml-5" title="编辑" href="javascript:;" onclick="show('分类编辑','<?php echo url('category/categorySave',['id'=>$v['id']])?>','','300')"><i class="Hui-iconfont">&#xe6df;</i></a>
        </td>
		</tr>
		<?php } if (empty($list)) {?>
		<tr class="text-l"><td colspan="20">没有找到匹配的记录</td></tr>
		<?php }?>
		</tbody>
	</table>
</div>
{/block}
<!--请在上方写此页面body相关内容-->

<!--请在下方写此页面业务相关的脚本-->
{block name="js"}
<script type="text/javascript">

</script>
{/block}
<!--/请在上方写此页面业务相关的脚本-->